<template>
<view class="container">
    <view class="account">
        <view class="price">{{userInfo.now_money}}</view>
        <view class="balance">我的余额</view>
    </view>
    <view class="recharge clearfix">
        <view class="recharge_l fl" @tap="go_recharge">
            <view class="charge clearfix">
                <view class="tubiao fl">+</view>充值
            </view>
        </view>
        <view class="recharge_r fr" @tap="go_withdraw">
            <view class="charge clearfix">
                <view class="tubiao fl">-</view>提现
            </view>
        </view>
    </view>
</view>
</template>

"<script>
// pages/my/my_money.js
import common from '../../utils/common.js'
var app = getApp();

export default {
  data() {
    return {
      userInfo: {}
    };
  },

  onUnload: function () {// 页面关闭
  },
  onHide: function () {// 页面隐藏
  },
  onShow: function () {// 页面显示
  // #ifdef H5
  common.hideWxShare()
  // #endif
  },
  onReady: function () {// 页面渲染完成
  },
  onLoad: function () {
    var that = this; //调用应用实例的方法获取全局数据

    common.getUserInfo(function (userInfo) {
      //更新数据
      that.setData({
        userInfo: userInfo
      });
      console.log(that.userInfo);
    });
  },
  components: {},
  props: {},
  methods: {
    go_recharge: function () {
      wx.navigateTo({
        url: "money_recharge"
      });
    },
    go_withdraw: function () {
      wx.navigateTo({
        url: "money_withdraw"
      });
    },
    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  }
};
</script>
<style>
.account{ background: #ff584c; text-align: center; color: #fff; padding: 80rpx 0;}
.account .price{ font-size: 48rpx;}
.recharge{ background: #ee4236;text-align: center;  line-height: 100rpx;  font-size: 32rpx; color: #fff; }
.recharge_l,.recharge_r{ width: 50%; height: 100rpx;  box-sizing: content-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box; }
.recharge_l{border-right:2rpx #d71708 solid;  }
.recharge .charge{ display: inline-block}
.recharge .tubiao{ width: 52rpx;height: 52rpx; line-height: 52rpx; border-radius: 100%; background: #fff; display:block; color:#ee4236; margin-top:24rpx; margin-right: 10rpx; font-size: 46rpx; }
</style>